#pragma once
#include <string>
#include "json/document.h"
#include "json/prettywriter.h"

template <typename T>
class JsonParser final {
public:
    bool read(const rapidjson::Value& doc, const std::string& key, T& value) const {
        if (!doc.HasMember(key.c_str())) {
            return false;
        }
        return read(doc[key.c_str()], value);
    }

    bool write(rapidjson::Document::AllocatorType& allocator, rapidjson::Value& doc, const std::string& key, const T& value) const {

        return false;
    }
public:
    bool empty(const T& value) const {return false;}
    bool read(const rapidjson::Value& doc, T& value) const {return false;}
    bool write(rapidjson::Document::AllocatorType& allocator, rapidjson::Value& doc, const T& value) const {return false;}

    bool from_key(const std::string& key, T& value) const {return false;}
    bool to_key(const T& value, std::string& key) const {return false;}
};

#include "JsonParser.inl"
#include "JsonParserStd.inl"
